package com.eastfair.projectcore.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 电子橱窗表
 * </p>
 *
 * @author ligang
 * @since 2021-08-09
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_hot_image")
@ApiModel(value = "HotImage", description = "电子橱窗表")
@AllArgsConstructor
public class HotImage extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 图片url
     */
    @ApiModelProperty(value = "图片url")
    @NotEmpty(message = "请填写图片url")
    @Size(max = 255, message = "图片url长度不能超过255")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "图片url")
    private String url;

    /**
     * 展商id
     */
    @ApiModelProperty(value = "展商id")
    @NotNull(message = "请填写展商id")
    @TableField(value = "exhibitor_id")
    @Excel(name = "展商id")
    private Long exhibitorId;

    /**
     * 展会id
     */
    @ApiModelProperty(value = "展会id")
    @NotNull(message = "请填写展会id")
    @TableField(value = "exhibition_id")
    @Excel(name = "展会id")
    private Long exhibitionId;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 是否推荐（0不推荐，1推荐）
     */
    @ApiModelProperty(value = "是否推荐（0不推荐，1推荐）")
    @TableField(value = "recommend")
    @Excel(name = "是否推荐（0不推荐，1推荐）", replace = {"是_true", "否_false", "_null"})
    private Boolean recommend;

    /**
     * 推荐时间
     */
    @ApiModelProperty(value = "推荐时间")
    @TableField(value = "recommend_time")
    @Excel(name = "推荐时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime recommendTime;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer enabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer deleted;


    @Builder
    public HotImage(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String url, Long exhibitorId, Long exhibitionId, Integer sequence, Boolean recommend, 
                    LocalDateTime recommendTime, Integer enabled, Integer deleted) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.url = url;
        this.exhibitorId = exhibitorId;
        this.exhibitionId = exhibitionId;
        this.sequence = sequence;
        this.recommend = recommend;
        this.recommendTime = recommendTime;
        this.enabled = enabled;
        this.deleted = deleted;
    }

}
